<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core">


    <ui:composition template="/WEB-INF/faces/template.xhtml">

        <!--Title -->
        <ui:define name="title">Login</ui:define>

        <!--Content-->
        <ui:define name="content">

            <h1>Login</h1>

            <c:if test="${param.loginfirst == '1'}">
                <h3>
                    <h:outputText value="You must log in to see this page!" />
                </h3>
            </c:if>

            <c:if test="${param.adminonly == '1'}">
                <h3>
                    <h:outputText value="Only administrators are allowed to view this page!" />
                </h3>
            </c:if>

            <c:if test="${param.booking == '1'}">
                <h3>
                    <h:outputText value="You have to login to book a room!" />
                </h3>
            </c:if>

            <c:if test="${param.error == '1'}">
                <h3>
                    <h:outputText value="Wrong username or password!" />
                </h3>
            </c:if>
            
            <p:panel> 
                <h:form>
                    <table>
                        <tr>
                            <td>Username:</td>
                            <td>
                                <h:inputText label="Username: *"
                                             id="uname" value="#{loginBackingBean.username}"
                                             required="true">
                                </h:inputText>
                                <h:message for="uname" />

                            </td>
                        </tr>
                        <tr>
                            <td>Password:</td>
                            <td>
                                <h:inputSecret label="Password: *"
                                               id="upass" value="#{loginBackingBean.password}" />
                                <h:message for="upassword" />
                            </td>
                        </tr>
                    </table>
                    <h:commandButton value="Login" action="#{loginBean.login}" />
                </h:form>
            </p:panel>
        </ui:define>
    </ui:composition>

</html>